import {createRouter, createWebHistory} from 'vue-router'
import Index from '~/pages/index.vue';
import About from '~/pages/about.vue';
import Login from '~/pages/login.vue';
import NotFound from '~/pages/404.vue';
import Admin from '~/layouts/admin.vue';

const routes = [{
    path: '/',
    component: Admin,
    // 子路由
    children: [{
        path: '/',
        component: Index,
        meta: {
            title: '后台首页'
        }
    }]
},
    {path: '/about', component: About, meta: {title: '关于'}},
    {path: '/login', component: Login, meta: {title: '登录'}},
    {path: '/:pathMatch(.*)*', name: 'NotFound', component: NotFound, meta: {title: '404'}},
];

const router = createRouter({
    history: createWebHistory(),
    routes,
})

export default router;
